package com.spt.springbootzhsx.service;

import com.spt.springbootzhsx.entity.Order;
import com.spt.springbootzhsx.entity.back.CountBack;
import com.spt.springbootzhsx.mapper.CinemaMapper;
import com.spt.springbootzhsx.mapper.MovieMapper;
import com.spt.springbootzhsx.mapper.OrderMapper;
import com.spt.springbootzhsx.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class CountImpl implements CountService{
    @Autowired
    private CinemaMapper cinemaMapper;
    @Autowired
    private MovieMapper movieMapper;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public CountBack getCMUOCount() {
        int c=cinemaMapper.getAllCinema().size();
        int m=movieMapper.getAllMovie().size();
        int u=userMapper.getAllUser().size();
        //int o=orderMapper.getAllOrder().size();
        ArrayList<Order> list=orderMapper.getAllOrder();
        int o=list.size();
        CountBack countBack=new CountBack(c,m,u,o);
        return countBack;
    }
}
